package 面试题50.哈希表实现;

import java.util.HashMap;

/**
 * @Author ：xu_xiaofeng.
 * @Date ：Created in 10:45 2021/2/2
 * @Description：
 */
class Solution {
    public char firstUniqChar(String s) {
        HashMap<Character, Boolean> hashMap = new HashMap();
        char[] sc = s.toCharArray();
        for (char c : sc) {
            hashMap.put(c, !hashMap.containsKey(c));
        }
        for(char c:sc){
            if (hashMap.get(c)){
                return c;
            }
        }

        return ' ';
    }
}
